home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / libraries / patchlibv3.lha / patchlibrary / includes / patch.h < prev    next >
C/C++ Source or Header  |  1994-05-04  |  5KB  |  130 lines

  1. #ifndef LIBRARIES_PATCH_H
  2. #define LIBRARIES_PATCH_H
  3. /*****************************************************************************/
  4. /*
  5. **    Filename:    libraries/patch.h
  6. **    Release:    3.0
  7. **    Date:        04.05.94
  8. **
  9. **    definition of patch.library public structures and returncodes
  10. **
  11. **    (C) Copyright 1993/94 Stefan Fuchs
  12. **    All Rights Reserved
  13. */
  14. /*****************************************************************************/
  15.  
  16. #ifndef    EXEC_TYPES_H
  17. #include <exec/types.h>
  18. #endif
  19.  
  20. #ifndef    EXEC_LISTS_H
  21. #include    <exec/lists.h>
  22. #endif    /* EXEC_LISTS_H */
  23.  
  24. #ifndef    EXEC_LIBRARIES_H
  25. #include    <exec/libraries.h>
  26. #endif    /* EXEC_LIBRARIES_H */
  27.  
  28. #ifndef    EXEC_SEMAPHORES_H
  29. #include    <exec/semaphores.h>
  30. #endif    /* EXEC_SEMAPHORES_H */
  31.  
  32.  
  33. /*----------------------------------------------------------------------------*/
  34. /* Structure required to install new patches via patch.library/InstallPatch() */
  35.  
  36. struct NewPatch                /*this structure is OBSOLETE from V2 on */
  37. {
  38.     APTR    NPAT_NewCode;        /* pointer to the patch code to be installed */
  39.     ULONG    NPAT_NewCodeSize;    /* optional length of NPAT_NewCode in bytes  */
  40.     APTR    NPAT_LibraryName;    /* pointer to the LibraryName                */
  41.     UWORD    NPAT_LibVersion;    /* version of Library to open                */
  42.     WORD    NPAT_LVO;        /* LVO of function to patch                  */
  43.     WORD    NPAT_Priority;        /* Priority (-127...+126) of the patch       */
  44.     UWORD    NPAT_Flags;        /* currently none defined (keep zero)        */
  45.     APTR    NPAT_PatchName;        /* optional pointer to an IDString           */
  46.     APTR    NPAT_Result2;        /* optional pointer to longword for Result2  */
  47. };
  48.  
  49. /*----------------------------------------------------------------------------*/
  50.  
  51. /* ErrorCodes */
  52. #define PATERR_Ok        0    /* Everything Ok                */
  53. #define PATERR_PatchInUse    1    /* Patch Usecount <> 0                */
  54. #define PATERR_InvalidHandle    2    /* Pointer to patch is not (no longer) valid    */
  55. #define PATERR_OutOfMem        3    /* Out of memory                */
  56. #define PATERR_OpenLib        4    /* Failed to open requested library        */
  57. #define PATERR_FuncNotStd    5    /* Function to patch is not in the standard format */
  58. #define PATERR_PatchInstalled    6    /* Can't remove patch because another program has  */
  59.                     /* installed a non-patch.library patch later       */
  60. #define PATERR_InvalidTags    7    /* There was an error in the combination of the specified Tags */
  61. #define PATERR_OpenDev        8    /* Failed to open requested device */
  62. #define PATERR_NoTaskList    9    /* PATT_AddTask... or PATT_RemTask... was specified for a patch, */
  63.                     /* which had no PATT_CreateTaskList set */
  64. #define PATERR_TaskListExists    10    /* PATT_CreateTaskList was specified, but there already exists a TaskList */
  65. #define PATERR_InvalidTaskList    11    /* PATT_CreateTaskList was specified with a wrong parameter */
  66. /*----------------------------------------------------------------------------*/
  67. #define    PatchName "patch.library"
  68.  
  69. /*----------------------------------------------------------------------------*/
  70.  
  71.  
  72.  
  73.  
  74. /*------------------------------------------------------------------------------*/
  75. /*------------------------------------------------------------------------------*/
  76. /* The following structures are not needed by normal patch.library applications */
  77. /*------------------------------------------------------------------------------*/
  78. /*------------------------------------------------------------------------------*/
  79. struct PatchBase
  80. {
  81.     struct Library LibNode;
  82.     UBYTE PB_Flags;                    /* no public flags defined */
  83.     UBYTE PB_reserved1;
  84.     ULONG PB_private1;
  85.     struct SignalSemaphore    PB_Semaphore;        /* Semaphore to protect MasterPatchList */
  86.     struct List        PB_MasterPatchHeader;    /* Listheader Structure for MasterPatch */
  87.  
  88.     /* ... */
  89.  
  90. };
  91.  
  92. /*----------------------------------------------------------------------------*/
  93. /* Before accessing this structure, make sure MPS_Node.ln_Type is PS_TYPE_MASTER */
  94.  
  95. struct MasterPatch            /* This structure is READONLY */
  96. {
  97. struct    Node    MPS_Node;        /* ln_Name may contain a pointer to the name of the patched library */
  98.     UWORD    MPS_Flags;        /* no public flags defined */
  99. struct    MinList    MPS_PatchHeader;    /* Listheader Structure for Patch structures */
  100. struct    Library    *MPS_PatchedLibraryBase; /* Pointer to patched Library */
  101.     UWORD    MPS_PatchedLVO;        /* Library Vektor Offset in patched library */
  102.  
  103.     /* ... */
  104.  
  105. };
  106.  
  107. /*----------------------------------------------------------------------------*/
  108. /* Before accessing this structure, make sure PS_Node.ln_Type is either PS_TYPE_USER or PS_TYPE_SYSTEM */
  109. /* Make sure your program can handle lists, that do not contain any nodes of */
  110. /* PS_TYPE_USER or PS_TYPE_SYSTEM */
  111.  
  112. struct    Patch            /* This structure is READONLY */
  113. {
  114. struct    Node    PS_Node;    /* ln_Name may contain a pointer to the name of the patch */
  115.     UWORD    PS_Flags;    /* no public flags defined */
  116.  
  117.     /* ... */
  118.  
  119. };
  120.  
  121. /*----------------------------------------------------------------------------*/
  122. /* public types for patch and masterpatch structures: */
  123. #define PS_TYPE_MASTER    1    /* node is MasterPatch structure */
  124. #define PS_TYPE_USER    2    /* node was installed by an Application using the library interface */
  125. #define PS_TYPE_SYSTEM    3    /* node was installed by a special patch.library Systemsoftware (not yet implemented) */
  126.  
  127.  
  128.  
  129. #endif    /* LIBRARIES_PATCH_H */
  130.